export const deepCopy = (obj) => {
  let newObj = obj instanceof Array ? [] : {}
  for (let key in obj) {
    newObj[key] = typeof obj[key] === 'object' ? deepCopy(obj[key]) : obj[key]
  }
  return newObj
}

export const findKey = (obj, tab) => {
  let k = deepCopy(obj)
  tab.forEach((i) => {
    k = k[i]
  })
  return k
}